function PlotGrid(grid)

colorBar = {'b','r','g','y','m'};

domainList = cell(grid.nBlock,1);

h = figure('Color',[1 1 1]);
for iBlock = 1:grid.nBlock
    
    domainList{iBlock} = CalcDomainBlock(grid.mesh{iBlock});
    
    coord = grid.mesh{iBlock}.coordinate;
    
    if(grid.type(iBlock) == 0)
        if(grid.mesh{iBlock}.nDim == 2)
            cellIndex = CalcCellUnstruct(grid.mesh{iBlock});
            nratio = 1;
            for iCell = 1:size(cellIndex,1)
                hpatch = patch(coord(cellIndex{iCell},1),coord(cellIndex{iCell},2),[1 0 0],'FaceAlpha',.5);
                hpatch.FaceAlpha = 0.3;
                hpatch.EdgeColor = [0 0 0];
                hpatch.LineStyle = '-';
                hold on
                if(iCell/size(cellIndex,1) > nratio/10)
                    disp(iCell/size(cellIndex,1))
                    nratio = nratio+1;
                end
            end
        elseif(grid.mesh{iBlock}.nDim == 3)
            faceIndex = CalcFace(grid.mesh{iBlock},grid.type(iBlock));
            nratio = 1;
            for iFace = 1:size(faceIndex,1)
                hpatch = patch(coord(faceIndex{iFace},1),coord(faceIndex{iFace},2),[1 0 0],'FaceAlpha',.5);
                hpatch.FaceAlpha = 0.3;
                hpatch.EdgeColor = [0 0 0];
                hpatch.LineStyle = '-';
                hold on
                
                if(iFace/size(faceIndex,1) > nratio/10)
                    disp(iFace/size(faceIndex,1))
                    nratio = nratio+1;
                end
            end
        end
    elseif(grid.type(iBlock) ==1)
        
        faceIndex = CalcFace(grid.mesh{iBlock},grid.type(iBlock));
        hpatch = patch('Vertices',coord,'Faces',faceIndex);
        if(rem(iBlock,length(colorBar))~=0)
            hpatch.FaceColor = colorBar{rem(iBlock,length(colorBar))};
        else
            hpatch.FaceColor = 'none';
        end
        hpatch.FaceAlpha = 0.3;
        hpatch.EdgeColor = [0 0 0];
        hpatch.LineStyle = '-';
        
    end
    
    hold on
    
end

domain = SwitchDomain(CalcDomain(domainList));
hold off
axis equal
axis(domain);
if(length(domain)/2 == 3)
    view([-1 -0.8 0.8])
end